/**
 *
 * Created by ThinkPad on 2018/11/16.
 */

$(document).ready(function () {
    $('#exchangeForm').bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            name: {
                validators: {
                    notEmpty: {
                        message: '请输入商品名称'
                    }
                }
            },
            points: {
                validators: {
                    notEmpty: {
                        message: '请输入兑换商品所需要的积分'
                    },
                    regexp:{
                        regexp:/^\d+$/,
                        message:'请输入正整数'
                    }
                }
            },
            remaining: {
                validators: {
                    notEmpty: {
                        message: '请输入库存量'
                    },
                    regexp: {
                        regexp: /^\d+$/,
                        message: "请输入正整数"
                    }
                }
            },
            imagesrc: {
                validators: {
                    notEmpty: {
                        message: "请上传产品图片"
                    }
                }
            },
            flag: {
                validators: {
                    notEmpty: {
                        message: "请选择商品状态"
                    }
                }
            }
        }
    });
});